#!/usr/bin/env bash
# Copyright (c) 2021 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(calculator)
pkgdesc="Touch-based calculator"
url=https://github.com/reHackable/Calculator
pkgver=0.0.0-16
timestamp=2020-08-20T12:28Z
section="math"
maintainer="Mattéo Delabre <spam@delab.re>"
license=GPL-3.0-or-later
installdepends=(display)
makedepends=(build:imagemagick build:librsvg2-bin)
flags=(patch_rm2fb)

image=qt:v2.1
source=(
    https://github.com/reHackable/Calculator/archive/7b8be5de12f1536bc04b6216abbf26f998097bf4.zip
    calculator.draft
    calculator.svg
)
sha256sums=(
    02116d385983f6c816374eb6d8b67e53a4a9650e42b0733ab2e145e8dcf87557
    SKIP
    SKIP
)

build() {
    qmake Calculator.pro
    make
    convert +set date:create +set date:modify calculator.{svg,png}
}

package() {
    install -D -m 755 "$srcdir"/Calculator "$pkgdir"/opt/bin/calculator
    install -D -m 644 -t "$pkgdir"/opt/etc/draft "$srcdir"/calculator.draft
    install -D -m 644 -t "$pkgdir"/opt/etc/draft/icons "$srcdir"/calculator.png
}
